furny.ga.rules
Class MinMaxCountRule

java.lang.Object
  extended by furny.ga.rules.MinMaxCountRule
All Implemented Interfaces:
IValidationRule<FurnLayoutIndividual>

public class MinMaxCountRule
extends java.lang.Object
implements IValidationRule<FurnLayoutIndividual>

This is a IValidationRule implementation that keeps the count of a furniture in an interval.

Since:
12.08.2012
Author:
Stephan Dreyer

Nested Class Summary
 
Nested classes/interfaces inherited from interface ga.core.validation.IValidationRule
IValidationRule.Type
 
Field Summary
private static java.util.logging.Logger LOGGER
           
private  int maxCount
           
private  int minCount
           
private  Tag tag
           
 
Constructor Summary
MinMaxCountRule(java.lang.String tagName, int minCount, int maxCount)
          Creates the rule for a given tag name with given minimum and maximum distances.
 
Method Summary
 IValidationRule.Type getType()
          Getter for the type of this rule.
 float matchingDegree(FurnLayoutIndividual individual, GAContext context)
          Calculates the matching degree in [0;1] for this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

minCount

private final int minCount

maxCount

private final int maxCount

tag

private final Tag tag
Constructor Detail

MinMaxCountRule

public MinMaxCountRule(java.lang.String tagName,
                       int minCount,
                       int maxCount)
Creates the rule for a given tag name with given minimum and maximum distances.

Parameters:
tagName - The name of the tag.
minCount - The minium count.
maxCount - The maximum count.
Since:
12.08.2012
Method Detail

matchingDegree

public float matchingDegree(FurnLayoutIndividual individual,
                            GAContext context)
Description copied from interface: IValidationRule
Calculates the matching degree in [0;1] for this rule. If the given individual does not match the rule, 0 will be returned.

Specified by:
matchingDegree in interface IValidationRule<FurnLayoutIndividual>
Parameters:
individual - The individual to test.
context - The GA context.
Returns:
The matching degree between 0 and 1.

getType

public IValidationRule.Type getType()
Description copied from interface: IValidationRule
Getter for the type of this rule.

Specified by:
getType in interface IValidationRule<FurnLayoutIndividual>
Returns:
The type.